**Final project report** Student 1 Jack Cui (f0080qh) Motivational image ======================================================================================= ![Mangrove trees](insp.jpg) Photo by Stockcake ![Entangled roots underwater and their reflection](insp2.jpg) Photo by Velvetfish These images are relevant to the project theme of "entangled", through the visible and entangled roots of the Mangrove tree and all of the life living in-between the roots. Features ======================================================================================= * Simple Extra Emitters (point light, spotlight, directional light) - directional light for sun * Simple Extra BSDFs - Oren-Nayar diffuse - Coating - Conductor (Microfacet (GGX, Beckmann)) * Environment Map Emitter (with importance sampling) - For modeling trees in the background and the sky (or any above-water scenery) * Homogenous Participating Media - For water * Photon Mapping - For efficiency in rendering underwater caustics/light shafts Simple Extra Emitters ======================================================================================= Point light --------------------------------------------------------------------------------------- Infinitesimally small delta light that emits energy equally in all directions from a single point in space. No surface area so creates hard shadows and cannot be sampled with BSDF sampling, only with Next Event Estimation (NEE). Radiance falls off with inverse-square distance.
point light
Directional light --------------------------------------------------------------------------------------- Delta-direction light source that uniformly emits light from infinitely far away in a single direction. Like a point light, cannot be sampled with BSDF sampling. Can be sampled with NEE by casting long shadow ray opposite of the light's direction. It's radiance is constant and does not fall off with distance. Photon emission for photon mapping is implemented.
directional light
Spot light --------------------------------------------------------------------------------------- Delta positional light source that emits from a single point but only within a finite cone of directions with a falloff from the cone center to the edges.
spot light
Spot lights have hard shadows but soft lighting at the edges of the cone due to falloff. Environment Map Emitter (with Importance Sampling) ======================================================================================= The environment map emitter uses equirectangular (latitude-longitude) format with importance sampling based on pixel luminance. A 2D distribution is precomputed where sampling probabilities are weighted by both pixel luminance and solid angle (sin θ factor) to efficiently sample bright regions while accounting for the distortion in equirectangular projection. The implementation includes proper PDF conversion from UV space to solid angle (with Jacobian factor 1/(2π² sin θ)) and supports both direct lighting samples and photon emission for photon mapping.
Sky envmap
Simple Extra BSDFs ======================================================================================= Rough conductor ---------------------------------------------------------------------------------------
rough conductors
From left to right: GGX (roughness=0.05), GGX (roughness=0.2), GGX (roughness=0.5), Beckmann (roughness=0.15), GGX (roughness=0.15) (Simple) rough conductor implementation using the Cook-Torrance microfacet BSDF: F * D * G / (4 * cos_i * cos_o) where * F is the Fresnel term (Schlick approximation) * D is either Beckmann or GGX normal distribution * G is the Smith masking-shadowing function (height-correlated form)
GGX Beckmann
Comparison of GGX (left) vs Beckmann (right) at the same roughness values [0.5, 0.3, 0.2, 0.1, 0.05, 0.01] from left to right. Note that Beckmann appears brighter/sharper at the same alpha values due to concentrating energy in the specular peak, while GGX has broader highlights due to it's longer tails. Coating ---------------------------------------------------------------------------------------
coating
This material simulates a thin dielectric over another material (similar to Mitsuba's plastic material) and chooses between a specular reflection or transmission to the base material based on the Fresnel coefficients. Similar to the Fresenel Mix material from an earlier assignment but works with MIS (sample(), pdf(), eval()). Oren-Nayar --------------------------------------------------------------------------------------- The Oren-Nayar BRDF models rough diffuse surfaces by accounting for interreflection between microfacets. The implementation precomputes coefficients A and B from the roughness parameter, then evaluates the reflectance using the azimuthal angle difference between incoming and outgoing directions and the polar angle relationship (sin α tan β terms). Cosine-weighted hemisphere sampling is used for importance sampling, reducing to standard Lambertian reflection when σ = 0.
Oren-Nayar
Left (Lambertian Diffuse), right (Oren-Nayar with roughness=0.8). Note how the Oren-Nayar sphere is darker overall and so is the shadow.
Oren-Nayar retroreflection
Roughness from left to right: (1.0, 0.66, 0.33, 0.0) in a scene where there is a point light next to the camera. On the right when roughness=0 Oren-Nayar is equivalent to Lambertian reflection. We see that as roughness increases, there is more darkening in the middle and brightening around the edges. This means that the A term decreases so the surface reflects less light overall and B term increases which causes an increase in brightness for light $\approx$ view directions that maxes out at grazing angles. Homogeneous Participating Media ======================================================================================= Extends standard path tracing to support participating media. - To properly weigh contributions across all channels, one RGB channel is randomly selected for free-flight distance sampling and is weighted with MIS. - At each path vertex, the integrator samples free-flight distances using exponential sampling characterized by absorption (σₐ) and scattering (σₛ) coefficients. - Volume scattering events use the Henyey-Greenstein phase function with asymmetry parameter g controlling forward (g > 0) versus backward (g < 0) scattering directionality. - The implementation features full next event estimation (NEE) at both volume and surface interactions with multiple importance sampling, properly computing shadow ray transmittance through multiple medium transitions at dielectric boundaries. - Medium tracking automatically handles entry/exit events when rays cross surfaces with associated interior/exterior media. The following plots are with $\alpha=0.4$ and $\sigma_t = 0.4$ with a Henyey-Greenstein phase function. Forward scattering:
g=0.0 g=0.5 g=0.99
Back scattering:
g=0.0 g=-0.5 g=-0.99
When going from one media to another some extra care needs to be taken for transmittance of the shadow ray.
g=-0.5 g=0.0 g=0.5
Glass balls with homogeneous media inside of them. Varying scattering and absorption coefficients: $\alpha=0.8$ and from left to right $\sigma_t = 0.015, 0.01, 0.008, 0.005, 0.002, 0.001$:
(Surface) Photon Mapping ======================================================================================= A two-pass algorithm that separates caustic and global illumination into distinct photon maps. - During the photon tracing pass, photons emitted from light sources are traced through the scene and stored on diffuse surfaces. Photons reaching diffuse surfaces after one or more specular bounces populate the caustic map, while photons with purely diffuse paths populate the global map. - Russian roulette path termination ensures unbiased photon power accumulation. - The rendering pass performs k-nearest neighbor searches with configurable radii and photon counts, using density estimation (Φ/πr²) to convert photon power to radiance. - At the first diffuse surface hit, the integrator combines direct lighting via next event estimation with MIS, caustic contributions from the caustic photon map, and indirect diffuse illumination via final gathering.
500k photons / 500 photons in radiance estimate MIS
Note the darkening around edges. The following uses final gather with 200k global (non-caustic) photons and 50k caustic photons.
Final gather MIS
## Progressive Photon Mapping Progressive photon mapping (PPM) addresses the bias-variance tradeoff in standard photon mapping through iterative refinement with a shrinking search radius. Each iteration rebuilds the photon map with a fresh set of photons traced from light sources. The rendering pass queries these photons at diffuse surfaces using k-nearest neighbor searches, where k remains constant but the maximum search radius shrinks each iteration. The radius progressively shrinks according to the Knaus & Zwicker formula: $r_{i+1}^2 = \frac{i+\alpha}{i+1}r_{i}^2$, where $\alpha$ controls the reduction rate. PPM with $\alpha=0.6, r_0=0.03$.
1 Iteration 10 Iterations 50 Iterations 100 Iterations
100 Iterations MIS
The implementation extends PPM to participating media by tracing photons through volumes and only storing photons at diffuse surface interactions. During rendering, the volumetric path tracer queries the photon map exclusively at first diffuse hits, while non-diffuse surfaces use standard path tracing with next event estimation. This lets us render nice scenes like the one below.
1 Iteration 30 Iterations 70 Iterations 120 Iterations
Final image =======================================================================================
Acknowledgements ======================================================================================= Envmaps and texture maps from Poly Haven. Tree generated using Sapling Tree Gen from Blender. Wave mesh from [Phil Gosch on Sketchfab](https://skfb.ly/6AHyp)